package com.autoMobile.servlet;

import com.autoMobile.bean.auto_management;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "PendingServlet", value = "/pend/PendingServlet")
public class PendingServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<auto_management> list = (List<auto_management>) getServletContext().getAttribute("autoList");
        List<auto_management> myList=new ArrayList<>();
        String zt =request.getParameter("zt");
        int ib =Integer.parseInt(request.getParameter("lb"));
        for (auto_management a: list) {
            if (a.getZhuang().equals(zt)){
                myList.add(a);
            }
        }
        getServletContext().setAttribute("pingList",myList);
        getServletContext().setAttribute("lb",ib);
        response.sendRedirect(request.getContextPath()+"/admin/pending-events.jsp");
    }
}
